function initPerformanceScoreCtl(formName, fieldName, formulaCode, params) {
	console.log('initPerformanceScoreCtl', formulaCode, params);
	// 函数宏控件在进入页面时，必进行计算
	var curFormId = formName;
	var oldValue = "cws-65536"; // 一个不存在的值
	if (fo(fieldName, curFormId)) { // 防止此控件此时还不存在
		oldValue = fo(fieldName, curFormId).value;
	}
	var sint = setInterval(function () {
		if (o(curFormId)) {
			if (fo(fieldName, curFormId)) {
				if (oldValue != fo(fieldName, curFormId).value) {
					oldValue = fo(fieldName, curFormId).value;
					onPerformanceScoreCtlRelateFieldChange(formName, fieldName, formulaCode, params);
				}
			} else {
			// 使关闭抽屉时，能够销毁setInterval，否则仅管前端removeScript了，但检测代码仍会运行
			window.clearInterval(sint);
			console.log('macro_formula_ctl_js clearInterval <%=field.getName()%>');
			}
		}
	}, 200);
	// 当菜单项不启用缓存时，只能通过如下方法才能清除interval
	getCurFormUtil().addInterval(sint, formName);
}

function onPerformanceScoreCtlRelateFieldChange(formName, fieldName, formulaCode, params) {
	var formulaStr = '';
	params = params.replaceAll(';', ',');
	var ary = params.split(',');
	var args = '';
	for (var i in ary) {
		var obj = fo(ary[i], formName);
		console.log('obj', obj);
		var val = obj ? obj.value : ' ';
		if (args == '') {
			args = val;
		} else {
			args += ',' + val;
		}
	}
	try {
			formulaStr = '#' + formulaCode + '(' + args + ')';
	}
	catch (e) {}
	var ajaxData = {
			formula: formulaStr,
	};
	ajaxPost('/visual/formula/doFormula', ajaxData).then((data) => {
		console.log('data', data);
		if (data.ret=="1") {
				var obj = fo(fieldName, formName);
				if (obj) {
						$(obj).val(data.value);

						setTimeout(function () {
								if(fo(fieldName + "_show", formName)) {
									fo(fieldName + "_show", formName).innerHTML = data.value;
								}
						}, 500);

						var frm = getCurForm();

						// 删除原来的验证，否则会因为原验证中存储的对象不存在而导致验证失效
						var formObj = LiveValidationForm.getInstance(frm);
						if (formObj) {
								formObj.removeFieldByName(fieldName);
						}
				}

				try {
						initCalculator();
				}
				catch(e) {}
		}
		else {
				console.error(data.msg);
				myMsg(data.msg, 'warning');
		}
	});
}